#include<bits/stdc++.h>
#define int long long

using namespace std;

int ret = 0;

map<pair<int, int>, int>mp;

int dirX[8] = {2, 1, -1, -2, -2, -1, 1, 2};
int dirY[8] = {1, 2, 2, 1, -1, -2, -2, -1};
int n, m;

bool check(int x, int y) {
	return x >= 1 && x <= n && y >= 1 && y <= n;
}

signed main() {
	
	cin >> n >> m;
	ret = n * n;
	
	while(m -- ) {
		int x, y;
		cin >> x >> y;
		if(mp[{x, y}] == 0) {
			mp[{x, y}] ++ ;
			ret --;
		}
		for(int i = 0; i < 8; i ++ ) {
			int xx = x + dirX[i];
			int yy = y + dirY[i];
			if(check(xx, yy) && mp[{xx, yy}] == 0 ) {
				mp[{xx, yy}] ++ ;
				ret -- ;
			} 
		}
	}
	cout << ret << endl;
	return 0;
}

